package org.atovio.coolexam.exception;

import lombok.Getter;
import org.atovio.coolexam.common.HttpCode;

/**
 * 业务处理发生的异常
 */
@Getter
public class ServiceException extends RuntimeException{

    // http状态码
    private final int code;

    public ServiceException(String message) {
        super(message);
        // 默认Http状态码为 500
        this.code = HttpCode.INTERNAL_SERVER_ERROR;
    }

    public ServiceException(int code, String message) {
        super(message);
        this.code = code;
    }

}
